﻿@{
   
}
@section head{
}
<div class="rightbar">
    <p class="righttit">
        <span>管理中心</span></p>
    <div class="rightshow">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabtit">
            <tr>
                <td width="10%" align="center">
                    <a href="@Url.Action("AdAreaDetail")">
                        <img alt="" src="@Url.Content("~/Areas/admin/image/add.jpg")" />
                        添加广告位</a>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tinfor1">
            <tr class="tinfor2">
                <td width="3%">
                    <input type="checkbox" name="checkbox" />
                </td>
                <td>
                    广告位名称
                </td>
                <td>
                    内容
                </td>
                <td>
                    操作
                </td>
            </tr>
            @foreach (var single in @Model.Rows)
            {
                <tr class="tinfor3">
                    <td>
                        <input type="checkbox" name="checkbox" />
                    </td>
                    <td>
                        @single["Title"]
                    </td>
                    <td>
                        @single["AreaContent"]
                    </td>
                    <td>
                        <a href="@Url.Action("AdAreaDetail", "AdMgr", new { id = @single["Id"] })" id="update">
                            修改</a>| <a href="###" id="delete" onclick='oDelete(@single["Id"])'>删除</a>
                    </td>
                </tr>
            }
        </table>
    </div>
</div>
@section Script{
    <script type="text/javascript">
        function oDelete(obj) {
            art.dialog.confirm('你确定要删除吗？', function () {
                doDelete(obj);
            }, function () {

            });
        }

        function doDelete(obj) {
            $.ajax({
                type: "POST",
                url: "/Admin/AdMgr/AdAreaDelete",
                data: { "id": obj },
                dataType: "text",
                success: function (msg) {
                    if (msg == "1") {
                        location.reload();
                    }
                    else {
                        art.dialog({
                            title: "提示",
                            icon: "warning",
                            content: "操作失败！",
                            time: 2
                        });
                    }
                },
                error: function () {
                    art.dialog({
                        title: "提示",
                        icon: "warning",
                        content: "网络忙，请稍后再试！",
                        time: 2
                    });
                }
            });
        }
    </script>
}
